﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace TeacherLeftHand.Model
{
    public class TMSearchCondition : ISearchCondition
    {
        #region properties
        private int _selectedClassLevel;
        private string _preferredSubject = "";
        private string _keyword = "";
        //private string _teamSize;
        //private string _tools;

        /// <summary>
        /// The <see cref="AdvancedSearchMode" /> property's name.
        /// </summary>
        public const string AdvancedSearchModePropertyName = "AdvancedSearchMode";

        private bool _advancedSearchMode = false;

        /// <summary>
        /// Gets the AdvancedSearchMode property.
        /// TODO Update documentation:
        /// Changes to that property's value raise the PropertyChanged event. 
        /// This property's value is broadcasted by the Messenger's default instance when it changes.
        /// </summary>
        public bool AdvancedSearchMode
        {
            get
            {
                return _advancedSearchMode;
            }

            set
            {
                if (_advancedSearchMode == value)
                {
                    return;
                }

                _advancedSearchMode = value;

                // Update bindings, no broadcast
                OnPropertyChanged(AdvancedSearchModePropertyName);
            }
        }

        public int SelectedClassLevel
        {
            get
            {
                return _selectedClassLevel;
            }
            set
            {
                if (_selectedClassLevel != value)
                {
                    _selectedClassLevel = value;
                    OnPropertyChanged("SelectedClassLevel");
                }
            }
        }

        public string Keyword
        {
            get { return _keyword; }
            set
            {
                if (_keyword != value)
                {
                    _keyword = value;
                    OnPropertyChanged("Keyword");
                }
            }
        }

        public string PreferredSubject
        {
            get { return _preferredSubject; }
            set
            {
                _preferredSubject = value;
                OnPropertyChanged("PreferredSubject");
            }
        }

        //public string TeamSize
        //{
        //    get { return _teamSize; }
        //    set
        //    {
        //        if (_teamSize != value)
        //        {
        //            _teamSize = value;
        //            OnPropertyChanged("TeamSize");
        //        }
        //    }
        //}

        //public string Tools
        //{
        //    get { return _tools; }
        //    set
        //    {
        //        if (_tools != value)
        //        {
        //            _tools = value;
        //            OnPropertyChanged("Tools");
        //        }
        //    }
        //}
        #endregion

        #region Implementation of INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
        #endregion

        #region constructor
        public TMSearchCondition()
        {
            Keyword = null;
            PreferredSubject = null;
            SelectedClassLevel = 0;
            //TeamSize = null;
            //Tools = null;
        }
        #endregion
    }
}
